ABC313 C - Approximate Equalization 2
提出
TLE
code: python
from collections import Counter
n = int(input())
a = list(map(int, input().split()))
# 4,7,3,7
# 4,6,4,7
# 5,6,4,6
# 5,6,5,5
# max - 1, min + 1
maxa = max(a)
mina = min(a)
ans = 0
c = Counter(a)
while abs(maxa - mina) >= 2:
else:
maxa -= 1
else:
mina += 1
ans += 1
print(max(ans - 1, 0))
解答
code: python
n = int(input())
a = list(map(int, input().split()))
suma = sum(a)
ave = suma // n
remain = suma % n
for i in range(remain):
a.sort()
b.sort()
ans = 0
for i in range(n):
print(ans//2)
テーマ
メモ
提出
code: python
n = int(input())
a = sorted(list(map(int, input().split())))
# print(a)
# TLE
ans = 0
for i in range(n//2):
while k - j > 1:
j += 1
k -= 1
ans += 1
print(ans)